package com.ruoyi.bluebera.service.impl;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bluebera.mapper.BizExchangeRatesMapper;
import com.ruoyi.bluebera.domain.BizExchangeRates;
import com.ruoyi.bluebera.service.IBizExchangeRatesService;

/**
 * 汇率记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-27
 */
@Service
public class BizExchangeRatesServiceImpl implements IBizExchangeRatesService 
{
    @Autowired
    private BizExchangeRatesMapper bizExchangeRatesMapper;

    /**
     * 查询汇率记录
     * 
     * @param id 汇率记录主键
     * @return 汇率记录
     */
    @Override
    public BizExchangeRates selectBizExchangeRatesById(Long id)
    {
        return bizExchangeRatesMapper.selectBizExchangeRatesById(id);
    }

    @Override
    public BigDecimal selectAvgRateOfLatest4()
    {
        return bizExchangeRatesMapper.selectAvgRateOfLatest4();
    }

    @Override
    public BizExchangeRates selectClosestExchangeRate(Date createdAt)
    {
        return bizExchangeRatesMapper.selectClosestExchangeRate(createdAt);
    }


    @Override
    public BizExchangeRates selectLatestExchangeRate(){
        return bizExchangeRatesMapper.selectLatestExchangeRate();
    }


    /**
     * 查询汇率记录列表
     * 
     * @param bizExchangeRates 汇率记录
     * @return 汇率记录
     */
    @Override
    public List<BizExchangeRates> selectBizExchangeRatesList(BizExchangeRates bizExchangeRates)
    {
        return bizExchangeRatesMapper.selectBizExchangeRatesList(bizExchangeRates);
    }

    /**
     * 新增汇率记录
     * 
     * @param bizExchangeRates 汇率记录
     * @return 结果
     */
    @Override
    public int insertBizExchangeRates(BizExchangeRates bizExchangeRates)
    {
        return bizExchangeRatesMapper.insertBizExchangeRates(bizExchangeRates);
    }

    /**
     * 修改汇率记录
     * 
     * @param bizExchangeRates 汇率记录
     * @return 结果
     */
    @Override
    public int updateBizExchangeRates(BizExchangeRates bizExchangeRates)
    {
        return bizExchangeRatesMapper.updateBizExchangeRates(bizExchangeRates);
    }

    /**
     * 批量删除汇率记录
     * 
     * @param ids 需要删除的汇率记录主键
     * @return 结果
     */
    @Override
    public int deleteBizExchangeRatesByIds(Long[] ids)
    {
        return bizExchangeRatesMapper.deleteBizExchangeRatesByIds(ids);
    }

    /**
     * 删除汇率记录信息
     * 
     * @param id 汇率记录主键
     * @return 结果
     */
    @Override
    public int deleteBizExchangeRatesById(Long id)
    {
        return bizExchangeRatesMapper.deleteBizExchangeRatesById(id);
    }
}
